package com.myk.game.lib;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

public abstract class DrawBuffer {

    private final Bitmap bufferBitmap;

    public DrawBuffer(int width, int height) {
        Paint bufferPaint = new Paint();
        bufferPaint.setAntiAlias(true);
        bufferPaint.setDither(true);
        bufferPaint.setFilterBitmap(true);
        this.bufferBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas bufferCanvas = new Canvas(this.bufferBitmap);
        onDraw(bufferCanvas, bufferPaint);
    }

    public Bitmap getBufferBitmap() {
        return bufferBitmap;
    }

    public abstract void onDraw(Canvas bufferCanvas,Paint bufferPaint);
}
